#ifndef DATABASEFILLUPDIALOG_H
#define DATABASEFILLUPDIALOG_H

#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QPushButton>
#include <QDialog>

#include "ItemNumberDialog.h"
#include "StockTableView.h"
#include "DataBase.h"
#include "dbms.h"

class DatabaseFillUpDialog : public QDialog
{
    Q_OBJECT
private:
    StockTableView *Table;

    DBMS *dbms;
    DataBase *db;

    ItemNumberDialog* NumberDialog;

    QPushButton *AddButton;
    QPushButton *RemoveButton;

    //QPushButton *SaveButton;
    //QPushButton *CancelButton;
    QPushButton *CloseButton;

    QHBoxLayout *AddRemoveButtonsLayout;
    QHBoxLayout *CloseButtonLayout;
    QVBoxLayout *MainLayout;

    QMap<QString, int> changes;

private:
    void closeEvent ( QCloseEvent * event );

private slots:
    void AddPressed();
    void RemovePressed();
    //void SavePressed();
    void ClosePressed();

    void clear();

   //void NoItemIsSelected();
    void Item( const ItemType& item, int count );

signals:
    //void RejectDatabase();
    //void AcceptDatabase( QMap<QString, int> changes );
    void ChangesMade( const QMap<QString, int> &changes );

public:
    DatabaseFillUpDialog( DBMS *dbms, /*DataBase *db,*/ QWidget* parent = 0 );
    ~DatabaseFillUpDialog();

    void SetDatabase( DataBase *db );
};

#endif // DATABASEFILLUPDIALOG_H
